package dao;

import java.util.List;

import db.MyDb;
import domain.User;

public class UserDao {

	public User find(String username, String password) {
		List<User> list = MyDb.getAll();
		for (User user : list) {
			if (user.getName().equals(username) && user.getPassword().equals(password)) {
				return user;
			}

		}

		return null;

	}

	public User find(String username) {
		List<User> list = MyDb.getAll();
		for (User user : list) {
			if (user.getName().equals(username)) {
				return user;
			}

		}
		return null;

	}

}
